using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration.Install;

namespace Musicman.WindowsService
{
    [RunInstaller(true)]
    public partial class Installer1 : Installer
    {
        public Installer1()
        {
            InitializeComponent();
        }

        protected override void OnBeforeInstall(System.Collections.IDictionary savedState)
        {
            base.OnBeforeInstall(savedState);
            if (!String.IsNullOrEmpty(this.Context.Parameters["servicename"]))
            {
                this.serviceInstaller1.ServiceName = this.Context.Parameters["servicename"];
                this.serviceInstaller1.DisplayName = this.Context.Parameters["servicename"];
            }
        }

        protected override void OnBeforeUninstall(System.Collections.IDictionary savedState)
        {
            base.OnBeforeUninstall(savedState);
            if (!String.IsNullOrEmpty(this.Context.Parameters["servicename"]))
            {
                this.serviceInstaller1.ServiceName = this.Context.Parameters["servicename"];
                this.serviceInstaller1.DisplayName = this.Context.Parameters["servicename"];
            }
        }
    }
}